package com.liyuhan.onlinetaxibackground.Repository;

import com.liyuhan.onlinetaxibackground.POJO.BasicOrder;
import com.liyuhan.onlinetaxibackground.POJO.Driver;
import com.liyuhan.onlinetaxibackground.POJO.Passenger;
import com.liyuhan.onlinetaxibackground.POJO.ReceivedOrder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface ReceivedOrderRepository extends JpaRepository<ReceivedOrder, Integer> {
    Optional<ReceivedOrder> findByOrder(BasicOrder order);

    Optional<List<ReceivedOrder>> findReceivedOrderByPassenger(Passenger passenger);

    Optional<List<ReceivedOrder>> findReceivedOrderByDriver(Driver driver);

    Optional<List<ReceivedOrder>> findReceivedOrderByPassengerAndState(Passenger passenger,String state);

    Optional<List<ReceivedOrder>> findReceivedOrderByDriverAndState(Driver driver,String state);
}
